home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / tutorials / custEducation / opengl2 / lib / error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  1.5 KB  |  43 lines

  1. /*
  2.  * Copyright 1993, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <GL/gl.h>
  22. #include <GL/glu.h>
  23.  
  24. /* This function can be called to check to see if an OpenGL error
  25.  * has occurred. The parameter to the function is a string that 
  26.  * can be used to provide information about where the function
  27.  * was invoked.  The programmer will typically call this function
  28.  * at the end of the rendering function, although it can be useful
  29.  * to call it in any function that is under development.  
  30.  * 
  31.  * Note that more than one error flag might have been set, so
  32.  * we loop until we have gotten all of them.
  33.  */
  34. GLvoid 
  35. checkError( char *label ) 
  36. {
  37.     GLenum error;
  38.  
  39.     while ((error = glGetError()) != GL_NO_ERROR ) {
  40.         fprintf( stderr, "%s: %s\n", label, gluErrorString(error));
  41.     }
  42. }
  43.